import express from "express"
const router = express.Router()
import { admin, protect } from "../middleware/auth.js"
import { 
  createOrder,
  getAllOrders,
  payOrder,
  getOrder,
  getUserOrders,
  deliverOrder,
  receiveOrder
} from "../controllers/order.js"

router.post("/", protect, createOrder)
router.get("/paging/list", protect, admin, getAllOrders)
router.get("/paging/list/:id",protect, getUserOrders)
router.route("/:id").get(protect,getOrder)
router.post("/pay/:id", protect, payOrder)
router.post("/receive/:id", protect,receiveOrder)
router.post("/deliver/:id", protect, admin,deliverOrder)


export default router